package com.example.control;

import com.example.bean.UserInfoBean;
import com.example.service.LoginService;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;
@Component("testController")
public class LoginControl {
    //使用spring xml 的配置方式，进行依赖注入
    @Resource(name = "loginSevice")
    LoginService loginService;
    @Resource(name = "UserInfoBean")
    UserInfoBean userInfoBean;
    //依赖一个集合对象 ， 也可以进行依赖注入
    List<Object> lstStrs;

    /**
     * 进行登录处理
     * @return
     */
    public boolean doLogin(){
        boolean canLogined= false;
        //调用service层
        System.out.println("依赖注入的集合内容:"+lstStrs);
        //进行登录业务逻辑
        canLogined=loginService.doLogin(userInfoBean);
        return canLogined;
    }
    public LoginService getLoginService() {
        return loginService;
    }

    public List<Object> getLstStrs() {
        return lstStrs;
    }

    public void setLstStrs(List<Object> lstStrs) {
        this.lstStrs = lstStrs;
    }

    public void setLoginService(LoginService loginService) {
        this.loginService = loginService;
    }

    public UserInfoBean getUserInfoBean() {
        return userInfoBean;
    }

    public void setUserInfoBean(UserInfoBean userInfoBean) {
        this.userInfoBean = userInfoBean;
    }
}
